{*
SPDX-FileCopyrightText: © 2021 Olivier Meunier <olivier@neokraft.net>

SPDX-License-Identifier: AGPL-3.0-only
*}
{{- import "/_libs/common" -}}
{{- textArch := .IsArchived ? "Remove from archive" : "Move to archive" -}}
{{- textFav := .IsMarked ? "Remove from favorites" : "Add to favorites" -}}

<turbo-frame id="bookmark-bottom-actions-{{ .ID }}">
<form action="{{ urlFor(`/bookmarks`, .ID) }}" method="post"
 class="flex flex-row max-sm:flex-col justify-center"
 data-controller="turbo-form"
 data-turbo-form-action-value="{{ urlFor(`/api/bookmarks`, .ID) }}"
 data-turbo-form-method-value="patch">
  {{ yield csrfField() }}
  <button class="btn-outlined-primary rounded-full whitespace-nowrap mb-0 mr-4 max-sm:mr-0 max-sm:mb-2"
   name="is_marked" value="{{ .IsMarked ? 0 : 1 }}">
    {{ yield icon(name=(.IsMarked ? "o-favorite-on" : "o-favorite-off")) }}
    {{ textFav }}
  </button>
  <button class="btn-outlined-primary rounded-full whitespace-nowrap"
   name="is_archived" value="{{ .IsArchived ? 0 : 1 }}">
    {{ yield icon(name=(.IsArchived ? "o-archive-on" : "o-archive-off")) }}
    {{ textArch }}
  </button>
</form>
</turbo-frame>
